import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
driver = webdriver.Chrome()
driver.get("http://sahitest.com/demo/selectTest.htm")
driver.maximize_window()
driver.implicitly_wait(15)
# 方式一：根据index下标来选择
select_element = driver.find_element(By.ID,"s1Id")
s1 = Select(select_element)
s1.select_by_index(2)


# 方式二：根据value
s1 = driver.find_element(By.ID,"s1")
s1 = Select(s1)
s1.select_by_value("48")

# 方式三：手动输入文本内容
s1 = driver.find_element(By.ID,"s1")
s1 = Select(s1)
s1.select_by_visible_text("Home Phone")


time.sleep(5)

